Full-Stack

Welcome Portfolio Projects Contact
↑ Go Back ↑

Install and configure Gitlab Runner

Install and configure Gitlab Runner

On host system

Create fedora container

lxc launch images:fedora/43/amd64 gitlab-runner-3

Set options required for docker

lxc config set gitlab-runner-3 security.nesting true lxc config set gitlab-runner-3 security.privileged true lxc restart gitlab-runner-3

Inside container

Update system

dnf update

Install docker

dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Enable docker

systemctl enable --now docker

Test if docker works

docker run hello-world

Install gitlab-runner

curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" -o script.rpm.sh bash script.rpm.sh dnf install gitlab-runner

Check if gitlab-runner service is running

gitlab-runner status

Register gitlab-runner

gitlab-runner register -> GitLab instance URL: https://gitlab.somedomain.com/ -> registration token: take from admin page https://gitlab.somedomain.com/admin/runners -> description for runner: leave default -> tags for the runner: leave default -> optional maintenance note for the runner: leave default -> executor: 'docker' -> default docker image: 'docker:stable'

Start a test run

gitlab-runner run After a while, press Ctrl+C to cancel

Additional config

Install nano editor

dnf install nano

Check gitlab-runner config file

nano /etc/gitlab-runner/config.toml

Fix iptables error inside container when running nf_tables

Install iptables-nft package

dnf install iptables-nft alternatives --config iptables -> select /usr/bin/iptables-nft instead of /usr/bin/iptables-legacy

Verify that nf_tables is running

iptables -V